﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace SIAKADCORE.Models
{
    /// <summary>
    /// Kelas Matakuliah [dbo].[matakuliah]
    /// </summary>
    public class Matakuliah
    {
        #region Constants
        /// <summary>
        /// Konstanta panjang id dari primary key
        /// </summary>
        public const int IdLength = 5;
        /// <summary>
        /// Konstanta prefix dari primary key
        /// </summary>
        public const string IdPrefix = "MK";
        /// <summary>
        /// Konstanta nama tabel pada database
        /// </summary>
        public const string TableName = "[dbo].[matakuliah]";
        /// <summary>
        /// Konstanta nama kolom idMatakuliah
        /// </summary>
        public const string ColumnNameIdMatakuliah = "[id_matakuliah]";
        /// <summary>
        /// Konstanta nama kolom namaMatakuliah
        /// </summary>
        public const string ColumnNameNamaMatakuliah = "[nama_matakuliah]";
        /// <summary>
        /// Konstanta nama kolom idPeriode
        /// </summary>
        public const string ColumnNameIdPeriode = "[id_periode]";
        #endregion

        #region Fields
        /// <summary>
        /// [id_matakuliah] CHAR(5) PRIMARY KEY
        /// </summary>
        private string idMatakuliah;
        /// <summary>
        /// [nama_matakuliah] TEXT NOT NULL
        /// </summary>
        private string namaMatakuliah;
        #endregion

        #region Properties
        /// <summary>
        /// [id_matakuliah] CHAR(10) PRIMARY KEY
        /// </summary>
        public string IdMatakuliah
        {
            get { return this.idMatakuliah; }
            set { this.idMatakuliah = value; }
        }

        /// <summary>
        /// [nama_matakuliah] TEXT NOT NULL
        /// </summary>
        public string NamaMatakuliah
        {
            get { return this.namaMatakuliah; }
            set { this.namaMatakuliah = value; }
        } 
        #endregion

        #region Constructors
        /// <summary>
        /// Konstruktor
        /// </summary>
        public Matakuliah()
        {

        }

        /// <summary>
        /// Konstruktor
        /// </summary>
        /// <param name="idMatakuliah">[id_matakuliah] CHAR(5) PRIMARY KEY</param>
        /// <param name="namaMatakuliah">[nama_matakuliah] TEXT NOT NULL</param>
        public Matakuliah(string idMatakuliah, string namaMatakuliah)
        {
            this.idMatakuliah = idMatakuliah;
            this.namaMatakuliah = namaMatakuliah;
        } 
        #endregion

        public override string ToString()
        {
            return string.Format("ID_MATAKULIAH: {0} | NAMA_MATAKULIAH: {1}", this.idMatakuliah, this.namaMatakuliah);
        }
    }
}
